const baseUrl = "http://localhost:8080";
let index_vue = new Vue({
    el: "#index_vue",
    data() {
        return {
            user_info: {}
        }
    },
    methods: {
        // 获取管理后台用户信息
        getAdminInfo() {
            /*
            API：http://localhost:8080/hotel/manage/index/user_info/{user_id}
            请求参数：user_id
            响应数据：UserEntity对象(json)
            */
            let user_id = window.location.href.toString().split("=")[1];
            axios({
                method: "get",
                url: baseUrl + "/hotel/manage/index/user_info/" + user_id,
                responseType: "json"
            }).then(response => {
                // console.log(response);
                this.user_info = response.data.data.user;
                if(response.data.data.state == "error") {
                    swal({
                        title: response.data.data.message,
                        text: "点击确定继续",
                        icon: response.data.data.state,
                        button: "确定",
                    }).then(value => {
                        window.location.href = baseUrl + "/" + url;
                    });
                }
            }).catch(error => {
                console.log("q请求失败！=> ",error);
            })
        }
    },
    created() {
        this.getAdminInfo();
    },
});